﻿    <script type="text/javascript">
        $(document).ready(function () {
            var p = new singlepage();
            p.c = "Way.Bus.WMS.ST.Controllers.OutOrder.ST_OutOrderController";
            p.applyTo = "t1";
            p.onCommandClick = function (command, form, item) {
                if (command == "edit") {
                    if (item.ISSUBMIT == true) {
                        form.setdisabled(true);
                    }
                }
            }
            p.onForeigned = function (sender, fdata, rows) {
                if (sender.field == 'MATERIALCODE') {
                    if (sender.parent && sender.parent.editrow) {
                        sender.parent.editrow.SOURCEROWID = rows.STAY1;
                    }
                }
            }
            p.onAfterEdit = function (grid, index, item, changes) {
                if (item.SOURCEROWID == undefined || item.SOURCEROWID != grid.editrow.SOURCEROWID)
                    item.SOURCEROWID = grid.editrow.SOURCEROWID;
            }

            p.onGridAddOrEdit = function (grid, cmd, item, ischild) {
                if (ischild) {
                    if (cmd == "add")
                        return false;
                    if (cmd == "edit") {
                        return item.SEQUENCECODE;
                    }
                }
            }
            p.onFromValChange = function (from, item, isgridfrom) {
                if (isgridfrom) {
                    var grid = from.findgrid("Way.Bus.WMS.Model.InSequence");
                    if (item.SEQUENCECODE != undefined)
                        grid.setdisabled(!item.SEQUENCECODE);

                }
            }
            p.init();
        });

        function emport5(data) {
            data.source.reload();
            $('<div id="d2"><div id="d3"/></div>').appendTo($("#temp"));
            var p2 = new singlepage();
            p2.c = "Way.Bus.WMS.ST.Controllers.ST_ExcelDCController";
            p2.applyTo = "d3";
            //p1.outc = form.parent.c;
            //p1.ssss = data;
            window.ddata = data;
            window.pdata = p2;
            p2.init();
            $('#d2').dialog({
                title: "导出数据",
                collapsible: false,
                width: 400,
                height: 320,
                cache: false,
                href: p2.datasource.url,
                onClose: function () {
                    $(this).panel('destroy');
                    $("#temp").empty();
                    window.ddata = null;
                }
            });
        }
    </script>
<div id="t1"></div>